package com.example.ass7.helper;

import java.util.StringTokenizer;

/**
 * @author Meirav Ben Izhak
 */
public class StringUtil {

    // Trim middle also
    /**
     * @param str
     *            str
     * @return String
     */
    public static String trimAll(String str) {
        StringTokenizer st = new StringTokenizer(str, " ");
        StringBuffer sb = new StringBuffer();
        while (st.hasMoreElements()) {
            sb.append(st.nextElement()).append(" ");
        }
        return sb.toString().trim();
    }

}
